package com.noble.meether.ui.wallet.detail.bean;

import com.noble.library.base.bean.BaseData;
import com.noble.library.utils.StringUtils;

import org.json.JSONObject;

/**
 * 收益明细
 */
public class Income extends BaseData {
    private String remark;
    private String typeAmountName;  // 展示title
    private double amount;
    private String timeCreate;
    private int statusPay;    // 默认状态 = -2  申请提现 = -1    提现到账 = 1

    private int typeAmount;   // -2: 邀请提现  -1：收益提现  amount为负数，其他为正数

    @Override
    public void parseJson(String jsonStr) {
        JSONObject jsonObject = getJsonObject(jsonStr);

        this.setRemark(jsonObject.optString("Remark"));
        this.setAmount(jsonObject.optDouble("Amount"));
        this.setTimeCreate(jsonObject.optString("TimeCreate"));
        this.setTypeAmountName(jsonObject.optString("TypeAmountName"));
        this.setTypeAmount(jsonObject.optInt("TypeAmount"));
        this.setStatusPay(jsonObject.optInt("StatusPay"));
    }

    /**
     * 是否为负数
     */
    public boolean isNegative() {
        return typeAmount == -2 || typeAmount == -1;
    }

    public int getTypeAmount() {
        return typeAmount;
    }

    public void setTypeAmount(int typeAmount) {
        this.typeAmount = typeAmount;
    }

    public String getTypeAmountName() {
        return typeAmountName;
    }

    public void setTypeAmountName(String typeAmountName) {
        this.typeAmountName = typeAmountName;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public double getAmount() {
        return amount;
    }

    public void setAmount(double amount) {
        this.amount = amount;
    }

    public String getTimeCreate() {
        return StringUtils.getCreateTime(timeCreate);
    }

    public void setTimeCreate(String timeCreate) {
        this.timeCreate = timeCreate;
    }

    public int getStatusPay() {
        return statusPay;
    }

    public void setStatusPay(int statusPay) {
        this.statusPay = statusPay;
    }
}
